
#include "Asset_Adapter.h"


/////////////////////////////////////
////          Struct part        ////
/////////////////////////////////////


Asset_Adapter_Conf::Asset_Adapter_Conf()
{
}



/////////////////////////////////////
////          Class part         ////
/////////////////////////////////////


Asset_Adapter::Asset_Adapter()
{
    m_sAsset_Adapter_Conf = new Asset_Adapter_Conf();
}

void Asset_Adapter::appSet(struct android_app* a_sApp)
{
    m_sAsset_Adapter_Conf->m_sApp = a_sApp;
    
    if(m_sAsset_Adapter_Conf->m_sApp != NULL)
    {
        m_sAsset_Adapter_Conf->m_cAssMgr = m_sAsset_Adapter_Conf->m_sApp->activity->assetManager;
    }
    //LOGI("assetManager: %s * %d \n", m_sAsset_Adapter_Conf->m_cAssMgr, m_sAsset_Adapter_Conf->m_cAssMgr, m_sAsset_Adapter_Conf->m_cAssMgr);
}

AAsset* Asset_Adapter::assOpen(const char* a_strfilename, int a_nMode)
{
    AAsset* _asset = AAssetManager_open(m_sAsset_Adapter_Conf->m_cAssMgr, a_strfilename, a_nMode);
    
    return _asset;
}


off_t Asset_Adapter::assSeek(AAsset* a_vAsset, off_t a_nOffset, int a_nWhence)
{
    off_t _result;
    _result = AAsset_seek(a_vAsset, a_nOffset, a_nWhence);
    return _result;
}







